export default {
  namespaced: true,
  state: {
    accessToken: null
  },
  mutations: {
    updateToken (state, token) {
      state.token = token
      localStorage.setItem('token', token)
    }
  },

  getters: {
    getToken (state) {
      if (state.token) {
        return state.token
      }
      return JSON.parse(localStorage.getItem('token'))
    }
  }
}
